<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改命题管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-title-edit" th:object="${actTitle}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">大赛名称：</label>
                <div class="col-sm-8">
                    <select name="gameId" class="form-control" th:with="games=${@gameService.selectGameList(null)}" required>
                        <option th:each="game : ${games}" th:text="${game.name}" th:value="${game.id}" th:field="*{gameId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">作品类别：</label>
                <div class="col-sm-8">
                    <select class="form-control" id="categoryId" name="categoryId">
                        <block  th:each="category : ${categoryTree}">
                            <block th:if="${#lists.isEmpty(category.children)}">
                                <option  th:text="${category.name}" th:value="${category.id}" th:field="*{categoryId}"></option>
                            </block>
                            <block th:if="not ${#lists.isEmpty(category.children)}">
                                <optgroup th:label="${category.name}">
                                    <block  th:each="child : ${category.children}">
                                        <option  th:text="${child.name}" th:value="${child.id}" th:field="*{categoryId}"></option>
                                    </block>
                                </optgroup>
                            </block>
                        </block>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">命题名称：</label>
                <div class="col-sm-8">
                    <textarea name="title" class="form-control" required>[[*{title}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">排序：</label>
                <div class="col-sm-8">
                    <input name="orderNum" th:field="*{orderNum}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/title";
        $("#form-title-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-title-edit').serialize());
            }
        }
    </script>
</body>
</html>
